package common.webresult;

import lombok.Synchronized;

import java.io.InputStream;
import java.util.Properties;

/**
 * @description 单例类，用于构造全局唯一的Properties类，并加载数据
 * @author lincat
 * @finish-time 2022.2.20
 */
class PropertiesCreator{

    private static Properties properties = null;

    @Synchronized
    static Properties getPropertiesInstance(){
        if(properties==null){
            try {
                properties = new Properties();
                String name = "webResult.properties";
                InputStream inputStream = PropertiesCreator.class.getResourceAsStream(name);
                properties.load(inputStream);
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        return properties;
    }
}
